package utils;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

public class ESClient {
    public static RestHighLevelClient getClient(){

        //创建HttpHost对象
        HttpHost httpHost = new HttpHost("10.9.12.200",9079);

        //创建RestClientBuilder
        RestClientBuilder clientBuilder = RestClient.builder(httpHost);

        //创建RestHighLevelClient
        RestHighLevelClient client = new RestHighLevelClient(clientBuilder);

        return client;
    }
}
